const qs = require('querystring');
// let string = 'name=wang&pass=123&sex=0';
// let obj = qs.parse(string);
// // 将 query 字符串变成 query 对象 split
// console.log(obj);//{ name: 'wang', pass: '123', sex: '0' }

//stringify //单词老师写错了
// let obj = {name:"wangyi", pass:'123', sex:'0'}
// let string = qs.stringify(obj,'^','?');
// console.log(string);//name?wangyi^pass?123^sex?0


// 编码
// let strinfg = 'w=你好&foo=bar';
// let result = qs.escape(strinfg);
// console.log(result); //w%3D%E4%BD%A0%E5%A5%BD%26foo%3Dbar
// 解码
let escape ='w%3D%E4%BD%A0%E5%A5%BD%26foo%3Dbar';
console.log(qs.unescape(escape));//w=你好&foo=bar






